package com.dream.common.utils.pickutils;

import com.dream.common.utils.JsonUtils;

import java.util.ArrayList;
import java.util.List;

public class TestUtils {
    public static void main(String[] args) {
        testBigSmall();
        testSingle();
        testMulti();
    }

    private static void testBigSmall() {
        ConfigurationBean configurationBean = new ConfigurationBean();
        configurationBean.isOpenBigSmall = true;
        configurationBean.isFenThunder = true;
        List<PickUserBean> pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 12.97));

        //中间枪比目标琻额大-枪
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallSmaller = false;
        configurationBean.bigSmallCompareMoney = 10;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-1:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //中间枪比目标琻额大（有免死）
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallSmaller = false;
        configurationBean.bigSmallCompareMoney = 11;
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "3";
        System.out.println("testBigSmall-2:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
        configurationBean.noDeadID = "2";
        System.out.println("testBigSmall-3:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //中间枪比目标琻额大-不枪
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallSmaller = false;
        configurationBean.bigSmallCompareMoney = 20;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-4:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //中间枪比目标琻额小-枪
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallSmaller = true;
        configurationBean.bigSmallCompareMoney = 13;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-5:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //中间枪比目标琻额小-枪（有免死）
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallSmaller = true;
        configurationBean.bigSmallCompareMoney = 9;
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "1";
        System.out.println("testBigSmall-6:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
        configurationBean.noDeadID = "3";
        System.out.println("testBigSmall-7:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));


        //中间枪比目标琻额小-不枪
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallSmaller = true;
        configurationBean.bigSmallCompareMoney = 2;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-8:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //中间枪目标尾数-不枪
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isNoDead = false;
        List<Integer> bigSmallTargetNumberList = new ArrayList<>();
        bigSmallTargetNumberList.add(0);
        bigSmallTargetNumberList.add(1);
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberList;
        System.out.println("testBigSmall-9:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //中间枪目标尾数-枪
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isNoDead = false;
        List<Integer> bigSmallTargetNumberLis2 = new ArrayList<>();
        bigSmallTargetNumberLis2.add(0);
        bigSmallTargetNumberLis2.add(3);
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberLis2;
        System.out.println("testBigSmall-10:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //中间枪目标尾数（有免死）
        configurationBean.isBigSmallMiddlePick = true;
        configurationBean.isBigSmallCompareMoney = false;
        List<Integer> bigSmallTargetNumberLis3 = new ArrayList<>();
        bigSmallTargetNumberLis3.add(0);
        bigSmallTargetNumberLis3.add(3);
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "1";
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberLis3;
        System.out.println("testBigSmall-11:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
        configurationBean.noDeadID = "2";
        System.out.println("testBigSmall-12:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最小-枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 2.95),
                new PickUserBean("4", 4.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallNoPickSmallestMoney = true;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-13:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最小-不枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 12.95),
                new PickUserBean("4", 14.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallNoPickSmallestMoney = true;
        configurationBean.isNoDead = false;
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberLis2;
        System.out.println("testBigSmall-14:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //扫尾不枪最小（有免死）
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 12.95),
                new PickUserBean("4", 14.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallNoPickSmallestMoney = true;
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "1";
        System.out.println("testBigSmall-15:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
        configurationBean.noDeadID = "2";
        System.out.println("testBigSmall-16:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最大-枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 18.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 12.95),
                new PickUserBean("4", 4.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallNoPickSmallestMoney = false;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-17:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最大-不枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 2.95),
                new PickUserBean("4", 4.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallNoPickSmallestMoney = false;
        configurationBean.isNoDead = false;
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberLis2;
        System.out.println("testBigSmall-18:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //扫尾不枪最大（有免死）
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.93),
                new PickUserBean("2", 4.95),
                new PickUserBean("3", 2.95),
                new PickUserBean("4", 30.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = true;
        configurationBean.isBigSmallNoPickSmallestMoney = false;
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "4";
        System.out.println("testBigSmall-19:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
        configurationBean.noDeadID = "2";
        System.out.println("testBigSmall-20:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最小蕾值-枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 18.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 12.95),
                new PickUserBean("4", 4.98));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isBigSmallNoPickSmallestEnd = true;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-21:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最小蕾值-不枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 2.95),
                new PickUserBean("4", 4.96));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isBigSmallNoPickSmallestEnd = true;
        configurationBean.isNoDead = false;
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberLis2;
        System.out.println("testBigSmall-22:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //扫尾不枪最小蕾值（有免死）
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.99),
                new PickUserBean("2", 4.91),
                new PickUserBean("3", 2.98),
                new PickUserBean("4", 30.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isBigSmallNoPickSmallestEnd = true;
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "2";
        System.out.println("testBigSmall-23:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
        configurationBean.noDeadID = "4";
        System.out.println("testBigSmall-24:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最大蕾值-枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.99),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 12.95),
                new PickUserBean("4", 4.98));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isBigSmallNoPickSmallestEnd = false;
        configurationBean.isNoDead = false;
        System.out.println("testBigSmall-25:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));

        //扫尾不枪最大蕾值-不枪
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 8.93),
                new PickUserBean("2", 10.95),
                new PickUserBean("3", 2.95),
                new PickUserBean("4", 4.91));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isBigSmallNoPickSmallestEnd = false;
        configurationBean.isNoDead = false;
        configurationBean.bigSmallTargetNumberList = bigSmallTargetNumberLis2;
        System.out.println("testBigSmall-26:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));

        //扫尾不枪最大蕾值（有免死）
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.92),
                new PickUserBean("2", 4.91),
                new PickUserBean("3", 2.94),
                new PickUserBean("4", 30.97));
        configurationBean.isBigSmallMiddlePick = false;
        configurationBean.isBigSmallCompareMoney = false;
        configurationBean.isBigSmallNoPickSmallestEnd = false;
        configurationBean.isNoDead = true;
        configurationBean.noDeadID = "2";
        System.out.println("testBigSmall-27:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), true));
        configurationBean.noDeadID = "4";
        System.out.println("testBigSmall-28:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "9", 5), false));
    }

    private static void testSingle() {
        ConfigurationBean configurationBean = new ConfigurationBean();
        configurationBean.isOpenBigSmall = false;
        configurationBean.isOpenSingle = true;
        configurationBean.isFenThunder = true;
        //単蕾中间枪
        configurationBean.isNoDead = false;
        configurationBean.isSingleMiddlePick = true;
        List<PickUserBean> pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.92),
                new PickUserBean("2", 4.91),
                new PickUserBean("4", 30.97));
        configurationBean.singleMiddlePickThunderNumber = 1;
        System.out.println("single-29:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), true));
        configurationBean.singleMiddlePickThunderNumber = 2;
        System.out.println("single-30:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), false));

        //単蕾中间枪（有免死）
        configurationBean.isSingleMiddlePick = true;
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.92),
                new PickUserBean("2", 4.91),
                new PickUserBean("4", 30.97));
        configurationBean.isNoDead = true;
        configurationBean.singleMiddlePickThunderNumber = 1;
        configurationBean.noDeadID = "2";
        System.out.println("single-31:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), true));
        configurationBean.noDeadID = "1";
        System.out.println("single-32:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), false));

        //単蕾扫尾
        configurationBean.isSingleMiddlePick = false;
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.93),
                new PickUserBean("2", 4.90),
                new PickUserBean("3", 4.91),
                new PickUserBean("4", 30.97));
        configurationBean.isNoDead = false;
        configurationBean.singleMiddlePickThunderNumber = 1;
        System.out.println("single-33:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), true));
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.93),
                new PickUserBean("2", 4.91),
                new PickUserBean("3", 4.97),
                new PickUserBean("4", 30.97));
        System.out.println("single-34:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), false));
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.92),
                new PickUserBean("2", 4.91),
                new PickUserBean("3", 4.97),
                new PickUserBean("4", 30.97));
        System.out.println("single-35:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), false));

        //単蕾扫尾（有免死）
        configurationBean.isSingleMiddlePick = true;
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 1.92),
                new PickUserBean("2", 4.91),
                new PickUserBean("3", 4.91),
                new PickUserBean("4", 30.97));
        configurationBean.isNoDead = true;
        configurationBean.singleMiddlePickThunderNumber = 1;
        configurationBean.noDeadID = "4";
        System.out.println("single-36:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), true));
        configurationBean.noDeadID = "1";
        System.out.println("single-37:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "2", 5), false));
    }

    private static void testMulti() {
        ConfigurationBean configurationBean = new ConfigurationBean();
        configurationBean.isOpenBigSmall = false;
        configurationBean.isOpenMulti = true;
        configurationBean.isFenThunder = true;
        //哆蕾
        List<PickUserBean> pickUserList = getPickUserListUtil(
                new PickUserBean("4", 10.97));
        System.out.println("Multi-38:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "345", 5), false));
        System.out.println("Multi-39:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "3456", 5), true));
        pickUserList = getPickUserListUtil(
                new PickUserBean("4", 10.93),
                new PickUserBean("4", 10.97));
        System.out.println("Multi-40:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "356", 5), false));
        System.out.println("Multi-41:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "456", 5), true));
        System.out.println("Multi-42:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "235", 5), false));

        pickUserList = getPickUserListUtil(
                new PickUserBean("4", 10.93),
                new PickUserBean("4", 10.91),
                new PickUserBean("4", 10.92),
                new PickUserBean("4", 10.97));
        System.out.println("Multi-43:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "37", 5), false));
        System.out.println("Multi-44:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "47", 5), true));
        System.out.println("Multi-45:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "167", 5), true));

        configurationBean.isNoDead = true;
        pickUserList = getPickUserListUtil(
                new PickUserBean("1", 10.93),
                new PickUserBean("2", 10.91),
                new PickUserBean("3", 10.92),
                new PickUserBean("4", 10.97));
        configurationBean.noDeadID = "1";
        System.out.println("Multi-46:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "37", 5), true));
        configurationBean.noDeadID = "1";
        System.out.println("Multi-47:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "123", 5), true));
        configurationBean.noDeadID = "4";
        System.out.println("Multi-48:" + isEqual(RedPackageIsPickUtils.isPick(configurationBean, 50, pickUserList, "123", 5), false));

    }

    private static List<PickUserBean> getPickUserListUtil(PickUserBean... pickUserBean) {
        List<PickUserBean> pickUserBeanList = new ArrayList<>();
        for (PickUserBean pickUser : pickUserBean) {
            pickUserBeanList.add(pickUser);
        }
        return pickUserBeanList;
    }

    private static boolean isEqual(boolean result, boolean expect) {
        return result == expect;
    }

}
